PM_FUNC_NORM_ATTRIB SKILL:SkillAbsorb( SKILL_CALL:iCall, Int:id )
{
	#pragma unused id
	switch( iCall )
	{
		case CALL_REGISTER: return SkillRegister( .Name = "Absorb", .Type = TYPE_GRASS, .callTypes = CALL_BIND_DOWN, .PP = 20, .Charges = 1, .DelayTime = 1.0 );
		case CALL_HELP:     return SkillHelp( "Pokemon absorbs HP equal to 1/2 the damage delt." );
		case CALL_BIND_DOWN:
		{
			return SKILL_USED;
		}
	}
	return SKILL_READY;
}

PM_FUNC_NORM_ATTRIB SKILL:SkillLeechSeed( SKILL_CALL:iCall, Int:id )
{
	switch( iCall )
	{
		case CALL_REGISTER: return SkillRegister( .Name = "Leech Seed", .Type = TYPE_GRASS, .callTypes = CALL_GIVE_DAMAGE, .PP = 10, .Charges = 5, .DelayTime = 10.0 );
		case CALL_HELP:     return SkillHelp( "Recieve health when you damage enemies." );
		case CALL_GIVE_DAMAGE:
		{
			new Float:fMaxHealth, Int:iMaxHealth;
			pev( id, pev_max_health, fMaxHealth );
			iMaxHealth = floatround( fMaxHealth );

			new Int:iHealth = get_user_health( id );
			new Int:iHeal = floatround( StatClamp( id, STAT_SPECIAL, g_fDamage * 0.1, g_fDamage * 0.5 ) );
			if ( iHealth < iMaxHealth && iHeal )
			{
				SoundHit( id );

				set_user_health( id, min( iHealth + iHeal, iMaxHealth ) );

				EffectScreenFlash( .iPlayer = id,
									.iRed = 0,
									.iGreen = 200,
									.iBlue = 0,
									.iAlpha = 50,
									.fTime = 0.1,
									.iFadeFlags = FFADE_MODULATE
								);

				return SKILL_USED;
			}
		}
	}
	return SKILL_READY;
}

PM_FUNC_NORM_ATTRIB SKILL:SkillMegaDrain( SKILL_CALL:iCall, Int:id )
{
	#pragma unused id
	switch( iCall )
	{
		case CALL_REGISTER: return SkillRegister( .Name = "Mega Drain", .Type = TYPE_GRASS, .callTypes = CALL_BIND_DOWN, .PP = 10, .Charges = 1, .DelayTime = 1.0 );
		case CALL_HELP:     return SkillHelp( "Pokemon absorbs HP from enemy equal to 1/2 the damage caused." );
		case CALL_BIND_DOWN:
		{
			return SKILL_USED;
		}
	}
	return SKILL_READY;
}

PM_FUNC_NORM_ATTRIB SKILL:SkillPetalDance( SKILL_CALL:iCall, Int:id )
{
	#pragma unused id
	switch( iCall )
	{
		case CALL_REGISTER: return SkillRegister( .Name = "Petal Dance", .Type = TYPE_GRASS, .callTypes = CALL_BIND_DOWN, .PP = 20, .Charges = 1, .DelayTime = 1.0 );
		case CALL_HELP:     return SkillHelp( "Damages, but Confuses Pokemon." );
		case CALL_BIND_DOWN:
		{
			return SKILL_USED;
		}
	}
	return SKILL_READY;
}

PM_FUNC_NORM_ATTRIB SKILL:SkillRazorLeaf( SKILL_CALL:iCall, Int:id )
{
	#pragma unused id
	switch( iCall )
	{
		case CALL_REGISTER: return SkillRegister( .Name = "Razor Leaf", .Type = TYPE_GRASS, .callTypes = CALL_BIND_DOWN, .PP = 25, .Charges = 1, .DelayTime = 1.0 );
		case CALL_HELP:     return SkillHelp( "Damages and has good chance of a critical hit." );
		case CALL_BIND_DOWN:
		{
			return SKILL_USED;
		}
	}
	return SKILL_READY;
}

PM_FUNC_NORM_ATTRIB SKILL:SkillSleepPowder( SKILL_CALL:iCall, Int:id )
{
	#pragma unused id
	switch( iCall )
	{
		case CALL_REGISTER: return SkillRegister( .Name = "Sleep Powder", .Type = TYPE_GRASS, .callTypes = CALL_BIND_DOWN, .PP = 15, .Charges = 1, .DelayTime = 1.0 );
		case CALL_HELP:     return SkillHelp( "Puts the target to sleep." );
		case CALL_BIND_DOWN:
		{
			return SKILL_USED;
		}
	}
	return SKILL_READY;
}

PM_FUNC_NORM_ATTRIB SKILL:SkillSolarBeam( SKILL_CALL:iCall, Int:id )
{
	#pragma unused id
	switch( iCall )
	{
		case CALL_REGISTER: return SkillRegister( .Name = "Solar Beam", .Type = TYPE_GRASS, .callTypes = CALL_BIND_DOWN, .PP = 10, .Charges = 1, .DelayTime = 1.0 );
		case CALL_HELP:     return SkillHelp( "The user prepares on turn one, becoming uncontrollable, and then attacks on turn two." );
		case CALL_BIND_DOWN:
		{
			return SKILL_USED;
		}
	}
	return SKILL_READY;
}

PM_FUNC_NORM_ATTRIB SKILL:SkillSpore( SKILL_CALL:iCall, Int:id )
{
	switch( iCall )
	{
		case CALL_REGISTER: return SkillRegister( .Name = "Spore", .Type = TYPE_GRASS, .callTypes = CALL_BIND_DOWN|CALL_ENTITY_THINK, .PP = 15, .Charges = 1, .DelayTime = 10.0 );
		case CALL_HELP:     return SkillHelp( "Creates a spore that makes nearby enemies fall asleep." );
		case CALL_BIND_DOWN:
		{
			new Coord:cAimOrigin[3], Vector:vAimOrigin[3];
			PlayerAimOrigin( id, cAimOrigin, .iDist = 300 );
			CoordToVector( cAimOrigin, vAimOrigin );

			new Float:fTime = StatClamp( id, STAT_SPECIAL, 10.0, 60.0 );

			EntitySkillCreate( .iPlayer = id,
								.fThinkTime = 0.5,
								.fKillTime = fTime,
								.iProperty = SEP_THINK|SEP_KILL,
								.iMoveType = MOVETYPE_NONE,
								.iSolidType = SOLID_NOT,
								.iModel = MODEL_FUNGUS,
								.vOrigin = vAimOrigin,
								.bPlayerAngles = true,
								.vMins = Vector:{-1.0,-1.0,-1.0},
								.vMaxs = Vector:{1.0,1.0,1.0}
								);

			return SKILL_USED;
		}
		case CALL_ENTITY_THINK:
		{
			new Int:iEnt = g_iAttacker;

			new Vector:vOrigin[3], Coord:cOrigin[3];
			EntityGetOrigin( iEnt, vOrigin );
			VectorToCoord( vOrigin, cOrigin );

			new Float:fRadius = StatClamp( id, STAT_SPECIAL, 100.0, 500.0 );

			new Int:iSleeped = StatusAoE( .iInflictorID = id,
										.cOrigin = cOrigin,
										.iStatus = STATUS_ASLEEP,
										.fRadius = fRadius,
										.iAmount = 1
										);

			if ( iSleeped )
			{
				SoundCast( iEnt );

				cOrigin[ 2 ] += 20;
				EffectBlastCircle( .cOrigin = cOrigin,
									.iSprite = SPRITE_TRAIL,
									.iRadius = floatround( fRadius ),
									.fLife = 1.0,
									.iWidth = 10,
									.iNoise = 0,
									.iRed = 255,
									.iGreen = 255,
									.iBlue = 255,
									.iAlpha = 255
								);
			}
		}
	}
	return SKILL_READY;
}

PM_FUNC_NORM_ATTRIB SKILL:SkillStunSpore( SKILL_CALL:iCall, Int:id )
{
	switch( iCall )
	{
		case CALL_REGISTER: return SkillRegister( .Name = "Stun Spore", .Type = TYPE_GRASS, .callTypes = CALL_BIND_DOWN|CALL_ENTITY_THINK, .PP = 30, .Charges = 1, .DelayTime = 10.0 );
		case CALL_HELP:     return SkillHelp( "Creates a spore that stuns nearby enemies." );
		case CALL_BIND_DOWN:
		{
			new Coord:cAimOrigin[3], Vector:vAimOrigin[3];
			PlayerAimOrigin( id, cAimOrigin, .iDist = 300 );
			CoordToVector( cAimOrigin, vAimOrigin );

			new Float:fTime = StatClamp( id, STAT_SPECIAL, 10.0, 60.0 );

			EntitySkillCreate( .iPlayer = id,
								.fThinkTime = 0.1,
								.fKillTime = fTime,
								.iProperty = SEP_THINK|SEP_KILL,
								.iMoveType = MOVETYPE_NONE,
								.iSolidType = SOLID_NOT,
								.iModel = MODEL_FUNGUS,
								.vOrigin = vAimOrigin,
								.bPlayerAngles = true,
								.vMins = Vector:{-1.0,-1.0,-1.0},
								.vMaxs = Vector:{1.0,1.0,1.0}
								);

			return SKILL_USED;
		}
		case CALL_ENTITY_THINK:
		{
			new Int:iEnt = g_iAttacker;

			new Vector:vOrigin[3], Coord:cOrigin[3];
			EntityGetOrigin( iEnt, vOrigin );
			VectorToCoord( vOrigin, cOrigin );

			new Int:iRadius = StatClamp( id, STAT_SPECIAL, 100, 500 );

			new CsTeams:iTeam = cs_get_user_team( id );
			new Coord:cPlayerOrigin[3];
			new Int:iStunned;
			LoopThroughPlayersFlags( iPlayer, PLAYER_FLAGS_ALIVE )
			{
				if ( iTeam == cs_get_user_team( iPlayer ) )
					continue;

				get_user_origin( iPlayer, cPlayerOrigin );
				if ( get_distance( cOrigin, cPlayerOrigin ) <= iRadius )
				{
					EntitySetVelocity( iPlayer, Vector:{0.0,0.0,0.0} );
					iStunned++;
				}
			}

			if ( iStunned )
			{
				SoundHit( iEnt );

				cOrigin[ 2 ] += 20;
				EffectBlastCircle( .cOrigin = cOrigin,
									.iSprite = SPRITE_SHOCKWAVE,
									.iRadius = iRadius,
									.fLife = 1.0,
									.iWidth = 10,
									.iNoise = 0,
									.iRed = 255,
									.iGreen = 255,
									.iBlue = 255,
									.iAlpha = 255
								);
			}
		}
	}
	return SKILL_READY;
}

PM_FUNC_NORM_ATTRIB SKILL:SkillVineWhip( SKILL_CALL:iCall, Int:id )
{
	switch( iCall )
	{
		case CALL_REGISTER: return SkillRegister( .Name = "Vine Whip", .Type = TYPE_GRASS, .callTypes = CALL_GIVE_DAMAGE, .PP = 10, .Charges = 1, .DelayTime = 3.0 );
		case CALL_HELP:     return SkillHelp( "Whips players you attack." );
		case CALL_GIVE_DAMAGE:
		{
			new Int:iDamage = StatClamp( id, STAT_ATTACK, 5, 20 );

			SkillDamage( .victim = g_iVictim,
						.attacker = id,
						.damage = iDamage
						);

			new Int:iPushStrength = StatClamp( id, STAT_SPECIAL, 250, 450 );
			new Vector:vVelocity[3];

			velocity_by_aim( id, iPushStrength, vVelocity );
			vVelocity[2] = floatmax( vVelocity[2], 200.0 );

			EntitySetVelocity( g_iVictim, vVelocity );

			EffectBeamEnts( .iPlayer = 0,
							.iStartEnt = id,
							.iEndEnt = g_iVictim,
							.iSprite = SPRITE_ROPE,
							.iStartFrame = 0,
							.iFrameRate = 10,
							.fLife = 1.0,
							.iLineWidth = iDamage,
							.iNoiseAmp = 20,
							.iRed = 0,
							.iGreen = 255,
							.iBlue = 0,
							.iAlpha = 255,
							.iScrollSpeed = 10
						);

			SoundHit( id );

			return SKILL_USED;
		}
	}
	return SKILL_READY;
}






